#ifndef __GZ_INTERFACE_ACTION_CONTEXT_H__
#define __GZ_INTERFACE_ACTION_CONTEXT_H__

#include <string>
#include <mutex>
#include <memory>
#include <atomic>

namespace Gazella {
class ActionContext: public std::enable_shared_from_this<ActionContext> {
public:
    ActionContext();
    ~ActionContext();

    bool is_canceling() const;

    void cancel();

    void send_feedback(const std::string& payload);
    void send_result  (const std::string& payload);
    void send_canceld (const std::string& payload);

    std::shared_ptr<ActionContext> get_sptr();

private:
    std::string __build_packet(int which, const std::string& payload);

public:
    std::string action_topic; //for feedbakc and result
    std::string action_session;
    std::string action_request; //cache request

private:
    std::atomic_bool m_cancel;
};
} //namespace Gazella

#endif